Skip to content

Conversation

@elinor-fung
Copy link
Member

Upstream changes from dotnet/runtime#121186

cc @dotnet/appmodel @kotlarmilos

Copilot AI review requested due to automatic review settings November 21, 2025 04:39
Copilot finished reviewing on behalf of elinor-fung November 21, 2025 04:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Mach-O format in Ready-to-Run (R2R) compilation, upstreamed from dotnet/runtime#121186. The changes enable R2R compilation for Apple platforms (iOS, tvOS, macOS, Mac Catalyst) by introducing a new container format option and a linking step to convert crossgen2's Mach-O object files into dylibs.

Key changes:

  • Adds PublishReadyToRunContainerFormat property (defaults to "pe", can be set to "macho" for Apple platforms)
  • Disables R2R symbol emission for all Apple runtime identifiers
  • Implements a new _LinkReadyToRunMachO target that links crossgen2-generated .o files into .dylib files using Apple's clang toolchain

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Microsoft.NET.CrossGen.targets Adds container format property, Apple platform symbol emission settings, telemetry for the new format, and implements _FindMachOToolchain and _LinkReadyToRunMachO targets for Mach-O linking
RunReadyToRunCompiler.cs Adds Crossgen2ContainerFormat parameter and passes it to crossgen2 via --obj-format argument
PrepareForReadyToRunCompilation.cs Adds Mach-O-specific logic to generate intermediate .o files and final .dylib files, with metadata to trigger native linking
MetadataKeys.cs Adds RequiresNativeLink and NativeLinkerInputPath metadata constants for coordinating the native linking step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant